load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "ttljob",
    srcs = [
        "ttljob.go",
        "ttljob_metrics.go",
        "ttljob_processor.go",
        "ttljob_query_builder.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/ttl/ttljob",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/jobs",
        "//pkg/jobs/joberror",
        "//pkg/jobs/jobspb",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/roachpb",
        "//pkg/security/username",
        "//pkg/server/telemetry",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catenumpb",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/execinfra",
        "//pkg/sql/execinfrapb",
        "//pkg/sql/isql",
        "//pkg/sql/lexbase",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/physicalplan",
        "//pkg/sql/rowenc",
        "//pkg/sql/rowexec",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sessiondata",
        "//pkg/sql/sessiondatapb",
        "//pkg/sql/sqltelemetry",
        "//pkg/sql/ttl/ttlbase",
        "//pkg/sql/types",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/ctxgroup",
        "//pkg/util/log",
        "//pkg/util/metric",
        "//pkg/util/metric/aggmetric",
        "//pkg/util/quotapool",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_prometheus_client_model//go",
    ],
)

go_test(
    name = "ttljob_test",
    size = "large",
    srcs = [
        "main_test.go",
        "ttljob_plans_test.go",
        "ttljob_processor_test.go",
        "ttljob_query_builder_test.go",
        "ttljob_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":ttljob"],
    exec_properties = {"test.Pool": "large"},
    shard_count = 4,
    deps = [
        "//pkg/base",
        "//pkg/ccl/crosscluster/replicationtestutils",
        "//pkg/ccl/kvccl/kvtenantccl",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/jobstest",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvserver",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catenumpb",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/catsessiondata",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/isql",
        "//pkg/sql/lexbase",
        "//pkg/sql/parser",
        "//pkg/sql/randgen",
        "//pkg/sql/rowenc",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sessiondata",
        "//pkg/sql/ttl/ttlbase",
        "//pkg/sql/types",
        "//pkg/testutils",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/metric",
        "//pkg/util/metric/aggmetric",
        "//pkg/util/protoutil",
        "//pkg/util/quotapool",
        "//pkg/util/randutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//require",
    ],
)
